var iconv = require('iconv-lite');


const spawn = require('child_process').spawn;
// var converterStream = iconv.decodeStream('win1251');
const ls = spawn('ping', ['www.4399.com']);


ls.stdout.on('data', (data) => {
    console.log(`stdout: ${iconv.decode(data, 'GBK')}`);
});

ls.stderr.on('data', (data) => {
    console.log(`stderr: ${data}`);
});

ls.on('close', (code) => {
    console.log(`child process exited with code ${code}`);
});